package cn.wh.core.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * @Author wanghao
 * @Date 2022-08-24 22:41
 * @Description: TODO
 */
public class FileSystemReource implements Resource {

    private final File file;

    private final String path;


    public FileSystemReource(File file) {
        this.file = file;
        this.path = file.getPath();
    }
    public FileSystemReource(String path) {
        this.file = new File(path);
        this.path = path;
    }

    public File getFile() {
        return file;
    }

    public String getPath() {
        return path;
    }

    @Override
    public InputStream getInputStream() throws FileNotFoundException {
        return new FileInputStream(this.file);
    }
}
